#ifndef __I2C_INTERFACE_H_
#define __I2C_INTERFACE_H_

#include "driver/i2c.h"
#include "driver/gpio.h"
#include <stdint.h>
typedef struct _i2c_interface_handle {
    void *unused;
} *i2c_interface_handle_t;


typedef struct _i2c_interface_config{
    i2c_port_t i2c_num;
    uint32_t scl_pin;
    uint32_t sda_pin;
    i2c_mode_t mode;
} i2c_interface_config;


i2c_interface_handle_t i2c_interface_create(const i2c_interface_config *config);

int32_t i2c_interface_write(i2c_interface_handle_t handle, uint16_t addr, const uint8_t *data, uint32_t length);

int32_t i2c_interface_write_to_device(i2c_interface_handle_t handle, uint16_t addr, const void *reg_data, size_t reg_size, const uint8_t *data, uint32_t length);

int32_t i2c_interface_read(i2c_interface_handle_t handle, uint16_t addr, uint8_t *data, uint32_t length);

int32_t i2c_interface_read_from_device(i2c_interface_handle_t handle, uint16_t addr, const void *reg_data, size_t reg_size, uint8_t *data, uint32_t length);

int32_t i2c_interface_destroy(i2c_interface_handle_t handle);
#endif

